/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package reloj.ejecutable;

import com.birosoft.liquid.LiquidLookAndFeel;

//import com.sun.java.swing.plaf.nimbus.NimbusLookAndFeel; OJO

import java.awt.BorderLayout;
import java.awt.Color;
import javax.swing.ImageIcon;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JProgressBar;
import javax.swing.JWindow;
import javax.swing.UIManager;
import javax.swing.plaf.metal.MetalLookAndFeel;
import javax.swing.plaf.multi.MultiLookAndFeel;
import javax.swing.plaf.synth.SynthLookAndFeel;
import relojbiometrico.IngresoSistema;

/**
 *
 * @author Dianita
 */
public class PantallaInicio extends JWindow {

    JPanel panelBarra = new JPanel();
    BorderLayout borde = new BorderLayout();
    JLabel panelImagen = new JLabel();
    JProgressBar barra = new JProgressBar();
    ImageIcon icono;

    public PantallaInicio(ImageIcon icono) {

        this.icono = icono;
        ventana();
        try {
//            NimRODTheme nt = new NimRODTheme();
//            nt.setPrimary1(new Color(200, 200, 200));
//            nt.setPrimary2(new Color(180, 180, 180));
//            nt.setPrimary3(new Color(160, 160, 160));
//
//            NimRODLookAndFeel NimRODLF = new NimRODLookAndFeel();
//            NimRODLF.setCurrentTheme(nt);
//            UIManager.setLookAndFeel(NimRODLF);

            UIManager.setLookAndFeel("com.birosoft.liquid.LiquidLookAndFeel");
            LiquidLookAndFeel.setLiquidDecorations(true, "mac");

            //UIManager.setLookAndFeel(new NimbusLookAndFeel());
            //   UIManager.setLookAndFeel(new WindowsLookAndFeel());
        } catch (Exception e) {
        }

    }

    public void ventana() {

        this.getContentPane().setLayout(borde);
        panelImagen.setIcon(icono);
        panelImagen.setSize(500, 500);
        //barra.setForeground(new Color(254, 173, 10));
        barra.setBorderPainted(false);
        barra.setForeground(Color.BLACK);
        //barra.setBounds(10, 10, 500, 10);
        panelBarra.setLayout(new BorderLayout());
        panelBarra.add(barra);
        this.getContentPane().add(panelImagen, BorderLayout.CENTER);
        this.getContentPane().add(panelBarra, BorderLayout.SOUTH);
        this.pack();
    }

    // fijar el maximo valor de la barra
    public void fijarValorMax(int max) {
        barra.setMaximum(max);
    }

    //fijar el valor actual de la barra
    public void fijarValor(int progreso) {
        barra.setValue(progreso);
    }

    public void progreso(String porcent, int valor) {
        fijarNumero(porcent);
        fijarValor(valor);
    }

    public void fijarNumero(String porcentaje) {
        if (porcentaje.equals("")) {
            //porcentaje="";
            barra.setStringPainted(false);
        } else {
            barra.setStringPainted(true);
        }
        barra.setString(porcentaje);
    }

    public void velocidadcarga() {
        for (int i = 0; i <= 100; i++) {
            for (int j = 0; j < 100000; ++j) {
                String poop = " " + (j + i) + "hola" + " como estan";
            }
            progreso(i + " % ", i);
        }

        this.dispose();

        IngresoSistema i = new IngresoSistema();
        i.setLocationRelativeTo(this);
        i.setVisible(true);


    }
}
